<?php
declare(strict_types=1);
/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://gitee.com/xmo/MineAdmin
 */

namespace Plugin\Alarm\Service;

use Plugin\Alarm\Repository\RdAlarmBroadcastRecordRepository;
use App\Service\IService;
use Plugin\Alarm\Model\RdAlarmMsg;

/**
 * 广播记录服务类
 */
final class RdAlarmBroadcastRecordService extends IService
{
    public function __construct(
        protected readonly RdAlarmBroadcastRecordRepository $repository
    ) {}

    public function shout(array $data)
    {
        $second = $data['start_time'] - $data['end_time'];
        return parent::create([
            'second' => $second,
            'start_time' => $data['start_time'],
            'end_time' => $data['end_time'],
            'type' => 2,
            'created_by' => $data['created_by'],
            'device' => $data['device'],
        ]);
    }

}